package de.jmda.fx.sandbox;

import javafx.application.Application;
import javafx.geometry.Point2D;
import javafx.scene.Group;
import de.jmda.fx.node.ArrowOrthogonal;
import de.jmda.fx.node.ArrowOrthogonal.Orientation;
import de.jmda.util.gui.awt.graphics.RelationEndpoint.Style;

public class SandboxArrow
    extends Sandbox
{
	private Group group;

	@Override
	protected Group getGroup()
	{
		if (group == null)
		{
			group = new Group();
		}
		
		return group;
	}
	
	@Override
	protected void populateGroup()
	{
		ArrowOrthogonal arrowLeftFilled =
				new ArrowOrthogonal(
						new Point2D(10, 10), 10, Style.FILLED, false, 4, Orientation.LEFT);
		ArrowOrthogonal arrowRightFilled =
				new ArrowOrthogonal(
						new Point2D(40, 10), 10, Style.FILLED, false, 4, Orientation.RIGHT);
		ArrowOrthogonal arrowUpFilled =
				new ArrowOrthogonal(
						new Point2D(60,  5), 10, Style.FILLED, false, 4, Orientation.UP);
		ArrowOrthogonal arrowDownFilled =
				new ArrowOrthogonal(
						new Point2D(80, 15), 10, Style.FILLED, false, 4, Orientation.DOWN);
		ArrowOrthogonal arrowLeftTransparent =
				new ArrowOrthogonal(
						new Point2D(10, 25), 10, Style.TRANSPARENT, false, 4, Orientation.LEFT);
		ArrowOrthogonal arrowRightTransparent =
				new ArrowOrthogonal(
						new Point2D(40, 25), 10, Style.TRANSPARENT, false, 4, Orientation.RIGHT);
		ArrowOrthogonal arrowUpTransparent =
				new ArrowOrthogonal(
						new Point2D(60, 20), 10, Style.TRANSPARENT, false, 4, Orientation.UP);
		ArrowOrthogonal arrowDownTransparent =
				new ArrowOrthogonal(
						new Point2D(80, 30), 10, Style.TRANSPARENT, false, 4, Orientation.DOWN);

		arrowLeftFilled.activateHighlighting();
		arrowLeftFilled.activateDragging();
		
		Group group = getGroup();
		
		group.getChildren().add(arrowLeftFilled);
		group.getChildren().add(arrowRightFilled);
		group.getChildren().add(arrowUpFilled);
		group.getChildren().add(arrowDownFilled);
		group.getChildren().add(arrowLeftTransparent);
		group.getChildren().add(arrowRightTransparent);
		group.getChildren().add(arrowUpTransparent);
		group.getChildren().add(arrowDownTransparent);
	}
	
	public static void main(String[] args)
  {
		Application.launch(args);
  }
}